Skip to content

Conversation

@rjcorrig
Copy link

@rjcorrig rjcorrig commented Mar 9, 2019

Summary

Changes access of the userAgentApplication member of the MSALAuthenticationProvider class to public

Motivation

Allows the ability to inspect and change the login state, by allowing access to the getUser() and logout() methods on the userAgentApplication member.

Test plan

Run this code snippet in a sample project to check if the client is logged in, and if so, log it out.

const authProvider = new MSALAuthenticationProvider(clientID, graphScopes, options);

const clientOptions: ClientOptions = {
  authProvider: authProvider
};

const client = Client.initWithMiddleware(this.clientOptions);

if (!!authProvider.userAgentApplication.getUser()) { // user logged in?
      authProvider.userAgentApplication.logout();  // log out
}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@msftclas
Copy link

msftclas commented Mar 9, 2019

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

❌ rjcorrig sign now
You have signed the CLA already but the status is still pending? Let us recheck it.

@muthurathinam
Copy link
Contributor

@rjcorrig Please sign the Contributor License Agreement
Refer: #150 (comment)

@rjcorrig
Copy link
Author

Waiting for permission from my employer... stay tuned.

@darrelmiller
Copy link
Contributor

@rjcorrig We are addressing this issue in a slightly different way in order to be consistent with how it is handled in our other language SDKs. The AuthenticationProvider will now accept a UserAgentApplication as a constructor parameter. This means that you can create your own application instance, hold onto it and use it to do Login/Logout etc.

@rjcorrig
Copy link
Author

@darrelmiller Is that on PR #154 ?

@darrelmiller
Copy link
Contributor

@rjcorrig Yes, sorry. I had intended on including a link to the PR.

@rjcorrig
Copy link
Author

Cool! That will work for my purposes. I'll go ahead and close this PR. Thanks!

@rjcorrig rjcorrig closed this Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants